<template>
    <div class="two">
        我是二弟{{ title }}
        <button @click="buy(100)">吃饭</button>
        <button @click="buy(10000)">谈对象</button>
        <button @click="buy(9999999999)">炒股</button>
    </div>
</template>

<script>
export default {
    inject: ['title'],
    created() {
        // $bus的缺点
        this.$bus.$on('tellToErDi', (data) => {
            console.log('大哥说', data)
        })
    },
    destroyed() {
        // 注销事件
        this.$bus.$off('tellToErDi')
    },
    methods: {
        buy(money) {
            this.$store.dispatch('BUY', money)
        }
    }
}
</script>


<style>
</style>